<template lang="html">
  <div class="main-page" id="store-page">
    <!-- 标题 -->
    <!-- <van-nav-bar class="main-header" title="商学院" :left-arrow="true" :fixed="true" :z-index="11" @click-left="onClickLeft"/> -->
    <nav-bar :title="'消息详情'"  @goBack="onClickLeft"/>
    <!-- 主体内容 -->
    <div class="main-content business_details has-header-space">
      <div class="business_details_page">
        <div class="details_title" style="text-align: center">{{details.title}}</div>
        <div class="detalis_content">
          <div class="article_content" v-html="details.content">
          </div>
          <div class="go_pruduct" @click="goProduct" v-if="details.item_id"> 立即购买 </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import NavBar from '@/components/global/nav-bar.vue'
export default {
  components: { NavBar },
  data () {
    return {
      details: {}
    }
  },
  created () {
    this.getDetalis(this.$route.params.id)
  },
  methods: {
    onClickLeft () {
      this.$router.go(-1)
    },
    goProduct () {
      this.$router.push('/main/shopDetails?pid=' + this.detail.product_id + '&item_id=' + this.detail.item_id)
    },
    getDetalis (id) {
      return new Promise((resolve, reject) => {
        this.$Axios({ url: 'shop_product_recommend/' + id, method: 'get' }).then((resp) => { // 请求成功
          if (resp.return_code === '0000') {
            this.details = resp.data
          }
          resolve(resp)
        }).catch((error) => { // 请求失败
          this.$_requestInterceptor('error', error)
          reject(error)
        })
      })
    }
  }
}
</script>
